/* 生成随机数组，找出数组中的最大最小值 */

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
    srand(time(NULL));
    int nums[10];
    for (int idx = 0; idx < 10; idx++)
    {
        int jdx = rand() % 200;
        nums[idx] = jdx;
        printf("nums[%d] = %d\n", idx, nums[idx]);
    }
    
    int max = nums[0], min = nums[0];
    for (int idx = 1; idx < 10; idx++)
    {
        if (nums[idx] > max)
        {
            max = nums[idx];
        }
        if (nums[idx] < min)
        {
            min = nums[idx];
        }
    }
    printf("max = %d\n", max);
    printf("min = %d\n", min);
}
